import requests
import json

# 目标URL
url = "https://ecp.sgcc.com.cn/ecp2.0/ecpwcmcore/index/noteList"

# JSON参数
data = {
    "index": 1,
    "size": 20,
    "firstPageMenuId": "2018060501171107",
    "orgId": "",
    "key": "",
    "year": "",
    "orgName": ""
}

# 设置请求头，模拟浏览器
headers = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3',
    'Content-Type': 'application/json'
}


# 发送POST请求
response = requests.post(url, json=data, headers=headers)

# 检查请求是否成功
if response.status_code == 200:
    # 将响应内容转换成JSON对象
    response_data = response.json()

    # 提取所需数据
    if 'resultValue' in response_data:
        data_list = response_data.get('resultValue').get('noteList')

        # 遍历数据列表并打印每个元素
        for item in data_list:
            print(item)
    else:
        print("No data found in the response.")
else:
    print(f"Failed to send POST request: {response.status_code}")